#include <opencv2/opencv.hpp>
#include <iostream>
#include <string>
#include <filesystem>

int main()
{
	// 1 获取当前项目路径
	std::filesystem::path path = std::filesystem::current_path();
	std::cout << "current path is : " << path << std::endl;

	// 2 读取图片
	// 2.1 构造路径
	std::string image_path = path.replace_filename("image/test_opencv.jpeg").string();
	std::cout << "current path is : " << image_path << std::endl;

	// 2.2 读取图片
	cv::Mat src = cv::imread(image_path, 1);

	// 2.3 图片空判断
	if (src.empty()) {
		printf("could not find the image!\n");
		return -1;
	}

	// 3 显示图片
	cv::imshow("ImputImage", src);
	cv::waitKey(0);

	return 0;
}

